import request from '@/utils/request'

import { systemServiceApi } from '../config'

const baseApi = '/dict-data'

export function create(data) {
  return request({
    url: systemServiceApi + baseApi,
    method: 'POST',
    data
  })
}

export function getList(params) {
  return request({
    url: systemServiceApi + baseApi,
    method: 'GET',
    params
  })
}

export function getById(id) {
  return request({
    url: systemServiceApi + baseApi + `/${id}`,
    method: 'GET'
  })
}

export function removeById(id) {
  return request({
    url: systemServiceApi + baseApi + `/${id}`,
    method: 'DELETE'
  })
}

export function updateById(id, data) {
  return request({
    url: systemServiceApi + baseApi + `/${id}`,
    method: 'PUT',
    data
  })
}

export function updateStatus(id, status) {
  return request({
    url: systemServiceApi + baseApi + `/${id}/status`,
    method: 'Patch',
    data: {
      status
    }
  })
}
